package com.moli.iov.base.model;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moli.iov.base.model.po.VehicleFence;
import com.moli.iov.base.util.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * 围栏
 *
 * @author wanghualin
 * @date 2019-09-21 16:43:48
 */
public class  VehicleFenceParam {

  private QueryWrapper<VehicleFence> queryWrapper;

  public VehicleFenceParam() {
    queryWrapper = new QueryWrapper<>();
    queryWrapper.eq("is_delete", 0);
  }

  public QueryWrapper<VehicleFence> get() {
    return queryWrapper;
  }

  public VehicleFenceParam queryLikeFenceName(String fenceName) {
    if (StringUtils.isNotBlank(fenceName)) {
      queryWrapper.like("fence_name", fenceName);
    }
    return this;
  }
  public VehicleFenceParam queryEqFenceName(String fenceName) {
    if (StringUtils.isNotBlank(fenceName)) {
      queryWrapper.eq("fence_name", fenceName);
    }
    return this;
  }
  public VehicleFenceParam queryLikeFenceArea(String fenceArea) {
    if (StringUtils.isNotBlank(fenceArea)) {
      queryWrapper.like("fence_area", fenceArea);
    }
    return this;
  }


  public VehicleFenceParam queryEqCompanyId(Long companyId) {
    if (companyId!=null) {
      queryWrapper.eq("company_id", companyId);
    }
    return this;
  }
  public VehicleFenceParam queryEqAlarmType(Integer alarmType) {
    if (alarmType!=null) {
      queryWrapper.eq("alarm_type", alarmType);
    }
    return this;
  }
  public VehicleFenceParam queryInFenceIds(List<Long> fenceIds) {
    if (fenceIds!=null&& !CollectionUtils.isEmpty(fenceIds)) {
      queryWrapper.in("id", fenceIds);
    }
    return this;
  }
}
